package com.reborn.mall.api.model.entity;

import com.google.common.collect.Lists;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import java.util.List;

/**
 * 商品分类表-实体类
 *
 * @author wu.yue
 * @since 2020/1/23
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "pms_product_category")
public class ProductCategory extends BaseEntity {

    
    private Long parentId;

    private String name;

    
    private Integer level;

    private Integer productCount;

    private String productUnit;

    
    private Integer navStatus;

    
    private Integer showStatus;

    private Integer sort;

    
    private String icon;

    private String keywords;

    
    private String description;

    private List<ProductCategory> children;

    public void addChild(ProductCategory child) {
        if (children == null) {
            setChildren(Lists.newArrayList());
        }
        children.add(child);
    }

}
